<input type="hidden" id="user_id" value="{$user.id}"/>
<div class="form-item">
 	<label class="item-label">认证状态<span class="check-tips">（实名认证）</span></label>
	<if condition="$user['is_auth'] eq false">
		<input type="input" class="text input-large" readonly value="未认证" />
	<else/>	
		<input type="input" class="text input-large" readonly value="已认证"/>
	</if>
 </div>
<div class="form-item">
 	<label class="item-label">标记说明<span class="check-tips">（如果对用户实名认证进行标记，必需给出说明）</span></label>
	<textarea id="note" class="div-desc"></textarea>
 </div>
 <div class="form-item">
 	<label class="item-label">标记记录<span class="check-tips"></span></label>
	<div id="note" class="div-desc">
		<foreach name="user['log']" key="key" item="val">
			<div>
				<strong>{:date('Y-m-d H:i:s', $val['create_time'])}　{$val.admin_name}</strong>
				<div>{$val.content}</div>
				<br/>
			</div>
		</foreach>
	</div>
 </div>
<div class="form-item">
	<if condition="$user['is_auth'] eq false">
		<button class="btn submit-btn" id="submit" type="submit" onclick="auth_realname(1);">认 证</button>
	<else/>	
		<button class="btn submit-btn" id="submit" type="submit" onclick="auth_realname(2);">取消认证</button>
	</if>
	<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
</div>

<script type="text/javascript">

function auth_realname(type)
{
	ajaxRequest("{:U('AppUser/realnameAuth')}", {"type":type,"id":$id,"note":$("#note").val()}, {"func":function(data){
		$container = $("#info_container");
		if(data) {
			if(data.error == 0) {
				alertDialog(data.info, 'alert-success', 3000);
				$("#realname_auth").click();
			} else {
				alertDialog(data.info, 'alert-error', 3000);
			}
		} else {
			alertDialog('实名认证信息查询失败', 'alert-error', 3000);
		}
	}});	
}
</script>